<template>
  <div class="article-detail">
    <!-- <van-nav-bar title="党建新闻" left-arrow @click-left="onClickLeft"/> -->
    <div class="title">{{detail.title}}</div>
    <div class="date">2019年03月06日07:20 来源：人民网－人民日报</div>
    <img class="img" :src="detail.image|imgPath" alt>
    <div class="content" v-html="detail.content"></div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      id: '',
      detail: {}
    }
  },
  created () {
    const id = this.$route.query.id
    if (id) {
      this.id = id
      this.getDetail()
    }
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    },
    getDetail (callback) {
      this.$axios
        .get('/xbkj-dj/web/article/getArticleById', {
          articleId: this.id
        })
        .then(res => {
          let detail = res.data
          detail.content = detail.content ? detail.content.replace(/\<img/gi, '<img style="width:100%;height:auto" ') : ''
          this.detail = detail
        })
    }
  }
}
</script>
<style lang="less" scoped>
.article-detail {
  background-color: #fff;
  padding-bottom: 60px;
  .title {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    padding: 10px 0;
  }
  .date {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-bottom: 10px;
  }
  .img{
      display: block;
      width: 100%;
  }
  .content{
      padding: 0 20px;
  }
}
</style>
